const { sendSuccess, sendError } = require('../utils/response');

module.exports = {
  // 上传图片
  uploadImages(req, res) {
    try {
      if (!req.files || req.files.length === 0) {
        return sendError(res, '未上传任何文件', 400);
      }
      
      const fileUrls = req.files.map(file => `/uploads/${file.filename}`);
      sendSuccess(res, { urls: fileUrls }, '图片上传成功');
    } catch (err) {
      sendError(res, err.message);
    }
  }
};